package io.renren.modules.car.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.car.entity.CarBaseEntity;
import io.renren.modules.car.service.CarBaseSelledService;
import io.renren.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;


/**
 * 车辆基本信息
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2021-09-17 11:28:03
 */
@RestController
@RequestMapping("car/carbaseselled")
public class CarBaseSelledController extends AbstractController {
    @Resource
    private CarBaseSelledService carBaseSelledService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("car:carbaseselled:list")
    public R list(@RequestParam Map<String, Object> params){
        params.put("create_user",getUserId());
        PageUtils page = carBaseSelledService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("car:carbase:info")
    public R info(@PathVariable("id") Integer id){
        CarBaseEntity carBase = carBaseSelledService.getMsgById(id);

        return R.ok().put("carBase", carBase);
    }
}
